var t = getApp();

Page({
    data: {
        recordsList: [],
        activeName: 0,
        currentTabIndex: 0,
        name: "",
        isLoadMore: !0,
        page: 1,
        total_page: 0
    },
    onLoad: function(t) {
        this.getName(), this.getData();
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareAppMessage: function() {},
    getUsable: function() {
        var a = this, e = t.getNetAddresss("plugin.coin.Frontend.Controllers.page.index");
        t._getNetWork({
            url: e,
            success: function(t) {
                1 === t.data.result ? a.setData({
                    usable: t.data.data.usable,
                    coin_name: t.data.data.coin_name
                }) : wx.showToast({
                    title: t.data.msg,
                    icon: "none"
                });
            },
            fail: function(t) {
                console.log(t);
            }
        });
    },
    getName: function() {
        var a = this, e = t.getNetAddresss("plugin.integral.Frontend.Controllers.page.get-name");
        t._getNetWork({
            url: e,
            success: function(t) {
                1 === t.data.result ? a.setData({
                    name: t.data.data.name
                }) : wx.showToast({
                    title: t.data.msg,
                    icon: "none"
                });
            },
            fail: function(t) {
                console.log(t);
            }
        });
    },
    handleClick: function(t) {
        var a = t.detail.index;
        this.data.currentTabIndex !== a && (this.setData({
            currentTabIndex: a
        }), this.getData());
    },
    getData: function() {
        var a = this, e = t.getNetAddresss("plugin.integral.Frontend.Modules.Integral.Controllers.Records");
        e += "&index=" + this.data.currentTabIndex, t._getNetWork({
            url: e,
            success: function(t) {
                1 === t.data.result ? (a.setData({
                    isLoadMore: !0,
                    page: 1,
                    total_page: t.data.data.pageList.last_page,
                    recordsList: t.data.data.pageList.data
                }), a.data.total_page || a.setData({
                    total_page: 0
                })) : wx.showToast({
                    title: t.data.msg,
                    icon: "none"
                });
            },
            fail: function(t) {
                console.log(t);
            }
        });
    }
});